<template>
    <div class="u-p-20">
        <el-card shadow="never">
            <div slot="header">
                <b class="u-f-16">
                    <span v-if="objForm.id">编辑</span>
                    <span v-else>添加</span>渠道商
                </b>
                <div class="u-right u-5mt">
                    <el-button type="success" size="small" icon="el-icon-document-checked" @click="submitForm('objForm')"
                        v-if="hasPerm('distributorEdit')">提交保存</el-button>
                    <el-button size="small" icon="el-icon-back" @click="$router.go(-1)">返回</el-button>
                </div>
            </div>
            <el-form :model="objForm" :rules="rules" ref="objForm" label-width="100px" class="u-form">
                <el-form-item label="渠道商名称">
                    <el-input type="text" v-model="objForm.name"></el-input>
                </el-form-item>
                <el-form-item label="电话号码">
                    <el-input type="text" v-model="objForm.phone"></el-input>
                </el-form-item>
                <el-form-item label="主营业务">
                    <el-input type="text" v-model="objForm.business"></el-input>
                </el-form-item>
                <el-form-item label="公司地址">
                    <el-input type="text" v-model="objForm.address"></el-input>
                </el-form-item>
                <el-form-item label="公司网址">
                    <el-input type="text" v-model="objForm.comp_url"></el-input>
                </el-form-item>
                <el-form-item label="备注信息">
                    <el-input type="text" v-model="objForm.remark"></el-input>
                </el-form-item>
                <el-form-item label="是否启用">
                    <el-switch v-model="objForm.status" active-color="#13ce66" :active-value="1" inactive-color="#666"
                        :inactive-value="2"></el-switch>
                </el-form-item>
            </el-form>
        </el-card>
    </div>
</template>

<script>
    import commonEdit from "@/mixins/common-edit";
    export default {
        mixins: [commonEdit],
        data() {
            return {
                apiName: "distributor",
                backRoute: "distributorIndex", //成功跳转地址
                objForm: {
                    id: "",
                    name: "", //名称
                    phone: "", //联系电话
                    business: "", //主营业务
                    address: "", //地址
                    comp_url: "", //公司网址
                    remark: "", //备注
                    status: 1, //状态
                }
            };
        },
        methods: {
            afterGetInfo() {
                //初始化-获取编辑数据
            }
        },
        created() {
            if (this.$route.params.id) {
                this.objForm.id = this.$route.params.id;
            }
        }
    };
</script>
